﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
	
<style type="text/css">
image{
max-width: 400px;
}
</style>
</head>
<body>
	<div class="ibox-content">
		<form class="form-horizontal" id="dataform"
			onsubmit="javascripr:return false;">
			<c:if test="${obj ne null }">
				<input type="hidden" name="id" value="${obj.id }">
			</c:if>
			<div class="form-group">
				<label class="col-sm-2 control-label">素材名称<span
					class="text-danger">*</span></label>
				<div class="col-sm-4">
					<input type="text" dataType="*1-100" class="form-control"
						name="name" value="<c:out value="${obj.name }"></c:out>">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">素材名称<span
					class="text-danger">*</span></label>
				<div class="col-sm-4">
					<select class="form-control autoFull"
						data-url="${path}/do/admin/dataDictionary/getItem/Material"
						id="catalog" name="catalog" data-filed="value" data-def="${obj.catalog}" >
						<option value="">请选分类</option>
					</select>
				</div>
			</div>
			<div class="form-group">
					<label class="col-sm-2 control-label">原图</label>
					<div class="col-sm-8">
						<input value="${obj.imgPath }" name="imgPath" id="imgPath" 
							class="form-control  upload-input" type="text" /> <a
							class="btn btn-primary radius upload-a"> <i
							class="fa fa-cloud-upload"></i> 上传图片
						</a>
					</div>

				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">预览图</label>
					<div class="col-sm-8">
						<input value="${obj.path }" name="path" id="path"
							class="form-control  upload-input" type="text" /> <a
							class="btn btn-primary radius upload-a"> <i
							class="fa fa-cloud-upload"></i> 上传图片
						</a>
					</div>

				</div>

				<div class="form-group">
					<label class="col-sm-2 control-label">元素<span
						class="text-danger">*</span></label>
					<div class="col-sm-8">
						<textarea class="form-control " rows="10" cols="20" name="element">${obj.element}</textarea>
					</div>
				</div>

				<div class="form-group ">
					<div class="col-sm-12 text-center">
						<a href="javascript:;" onclick="myForm.submit()"
							class="btn btn-success radius"><i class="fa fa-check"></i> 保存</a>&nbsp;&nbsp;&nbsp;&nbsp;
						<a class="btn btn-danger radius" href="javascript:;"
							onclick="MTools.closeForm()"><i class="fa fa-close"></i> 关闭</a>
					</div>
				</div>
		</form>
	</div>
</body>
<script type="text/javascript"
	src="${path }/resource/js/systools/MJsBase.js"></script>
<script type="text/javascript">
var url="${path}/do/admin/material/addBizMaterial";
<c:if test="${obj ne null }">
url="${path}/do/admin/material/modifyBizMaterial"
</c:if>
	MTools.autoFullSelect();
	$(".select2").select2();
	var myForm = MForm.initForm({
		invokeUrl : url,
		afterSubmit : function() {
			parent.myGrid.serchData();
		},
	});

	$(function() {
		$(".select2").select2({
			'width' : '100%'
		});
		MUI.initImgUpload(".upload-input");
	});

	MTools.autoFullSelect();
</script>
</body>
</html>